package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.service.DamageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/damageListGoods")
public class DamageController {

    @Autowired
    private DamageService damageService;

    @PostMapping("save")
    public ServiceVO save(DamageList damageList, String damageListGoodsStr){
        damageService.save(damageList,damageListGoodsStr);
        return new ServiceVO(SuccessCode.SUCCESS_CODE, SuccessCode.SUCCESS_MESS,null);
    }

    @PostMapping("list")
    public Map<String,Object> getdamageList (String sTime,String eTime){
        Map<String,Object> map = damageService.getdamageList(sTime,eTime);
        return map;
    }

    @PostMapping("goodsList")
    public Map<String,Object> getdamageGoodsList (Integer damageListId){
        Map<String,Object> map = damageService.getdamageGoodsList(damageListId);
        return map;
    }

}
